﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CStock
{
  
    public class FundamentalData :  IFundamentalData
    {
        
        //string dateString;
        DateTime date;
        //MSN: KGV
        double pE; 
        string id;
        double pricePerSales;
        double pricePerBook;
        //--
        double bVPS;//book value of equity per share = Book value of equity / # of shares //MSN: Eigenkapitalrendite %
        //--
        //public double ;
        double rOIC; //(MSN: ReturnOnEquity) : return on invested capital = net profit after tax/(Equity + debt)
        //MSN: Kurs/Umsatz (sollte umgerechnet werden ...)
        
       

        //------------------
        private double sales;
        private double eBIT;
        
        private double depreciations;//Abschreibungen
        private double incomeNet;
        double ePS; 
        private double taxRate;
        private double assets;
        private double liabilitiesAll;
        private double equity;
        private double cashFlow;
        

        private long noShares;

        public FundamentalData(string myID)
        {
            this.id = myID;
        }
        public FundamentalData()
        {
            this.id = "--";
        }
        public static IFundamentalData GetItemFromListPerDate(DateTime dt, IList<IFundamentalData> list)
        {
            for (int i = 0; i < list.Count; i++)
            {
                FundamentalData fd = list[i] as FundamentalData;
                if (fd.Date.Year == dt.Year && fd.Date.Month == dt.Month)
                {
                    return fd;
                }
            }
            return null;

        }
        public string ID
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public DateTime Date
        {
            get
            {
                return this.date;
            }
            set
            {
                this.date = value;
            }
        }
      
        public double PE
        {
            get
            {
                return this.pE;
            }
            set
            {
                this.pE = value;
            }
        }
        public double PricePerSales
        {
            get
            {
                return this.pricePerSales;
            }
            set
            {
                this.pricePerSales = value;
            }
        }
          public double PricePerBook
        {
            get
            {
                return this.pricePerBook;
            }
            set
            {
                this.pricePerBook = value;
            }
        }

          public double BVPS
          {
              get
              {
                  return this.bVPS;
              }
              set
              {
                  this.bVPS = value;
              }
          }
        //book value
          public double BV
          {
              get
              {
                  return this.assets - this.liabilitiesAll;
              }
           
          }

          public double ROIC
          {
              get
              {
                  return this.rOIC;
              }
              set
              {
                  this.rOIC = value;
              }
          }

          public double Equity
          {
              get
              {
                  return this.equity;
              }
              set
              {
                  this.equity = value;
              }
          }
          public double CashFlow
          {
              get
              {
                  return this.cashFlow;
              }
              set
              {
                  this.cashFlow = value;
              }
          }
        
        //------------------------------
          public double Sales
          {
              get
              {
                  return this.sales;
              }
              set
              {
                  this.sales = value;
              }
          }

        //earnings (income) before tax
          public double EBIT
          {
              get
              {
                  return this.eBIT;
              }
              set
              {
                  this.eBIT = value;
              }
          }
            [System.Xml.Serialization.XmlIgnoreAttribute()]
          public double Depreciations
          {
              get
              {
                  return this.depreciations;
              }
              set
              {
                  this.depreciations = value;
              }
          }

          public double IncomeNet
          {
              get
              {
                  return this.incomeNet;
              }
              set
              {
                  this.incomeNet = value;
              }
          }
         
          public double EPS
          {
              get
              {
                  return this.ePS;
              }
              set
              {
                  this.ePS = value;
              }
          }
          public double TaxRate
          {
              get
              {
                  return this.taxRate;
              }
              set
              {
                  this.taxRate = value;
              }
          }
         public double Assets
          {
              get
              {
                  return this.assets;
              }
              set
              {
                  this.assets = value;
              }
          }
         public double LiabilitiesAll
          {
              get
              {
                  return this.liabilitiesAll;
              }
              set
              {
                  this.liabilitiesAll = value;
              }
          }
         public long NoShares
         {
             get
             {
                 return this.noShares;
             }
             set
             {
                 this.noShares = value;
             }
         }
        
        


    }
}
